home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $Id: I3DShTre.H 1.56 1997/06/23 00:13:13 john Exp $ */ /*****************************************************************************\ * * * I3DShTre.h * * I3DShTreeElement definition * * * * Copyright (c) 1995, Ray Dream, Inc. All rights reserved. * * * \*****************************************************************************/ #ifndef __I3DSHTRE__ #define __I3DSHTRE__ #ifndef __3DCOTYPE__ #include "3DCoType.h" #endif #ifndef __I3DSHOBJ__ #include "I3DShObj.h" #endif #ifndef __I3DEXLIT__ #include "I3DExLit.h" #endif struct I3DShScene; struct IShRasterOffscreen; struct I3DExReflectionFeature; struct I3DExRefractionFeature; struct I3DExShadowFeature; struct I3DExGenericData; //****** Globally Unique Ids ************************************************** DEFINE_GUID(IID_I3DShTreeElement, 0xD68FEB00L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(IID_I3DShGroup, 0xD8B0A820L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(IID_I3DShInstance, 0xDAF2F700L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(IID_I3DShCamera, 0xE76CA120L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(IID_I3DShLightsource, 0xE9F9B4A0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(IID_I3DShExtension, 0xE9F9B4A1L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); // Classes always available with Ray Dream Designer 3: DEFINE_GUID(CLSID_StandardGroup, 0xEBE99DC0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardInstance, 0x2C00DD40L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardConicalCamera, 0x2E971880L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardIsometricCamera, 0x3063E940L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardSpotLight, 0x31F6BE40L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardBulbLight, 0x33806B80L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); DEFINE_GUID(CLSID_StandardDistantLight, 0x353C7360L, 0x3A05, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02); // Preset codes for I3DShCamera::Preset(): enum {kReferencePreset, kTopPreset, kBottomPreset, kLeftPreset, kRightPreset, kFrontPreset, kBackPreset}; //psq: should be redefined differently struct IShRasterOffscreen; struct I3DShTreeBehavior; struct I3DShDeformer; typedef void* (*UVMapConvertProc)(IShRasterOffscreen *offscreen,long channel); typedef void (*UVMapDeleteProc)(void *convertedUVMap, long channel); /*****************************************************************************\ * I3DShTreeElement * * * * I3DShTreeElement is the abstract class of all elements in a tree. * * * * You can always get this interface from a I3DShGroup, I3DShInstance, etc. * * * \*****************************************************************************/ /*for SetGlobalTransform8 mode */ #define kXTreeBehaviorDefault 0 #define kXTreeBehaviorTrackT 1 #define kXTreeBehaviorTrackR 2 /* Behavior Message Flags */ #define kBMUpdatePhysics 1 #define kPathNameSeparator '.' #undef INTERFACE #define INTERFACE I3DShTreeElement DECLARE_INTERFACE_(I3DShTreeElement, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShTreeElement methods STDMETHOD(SetScene) (THIS_ I3DShScene* scene) PURE; // This must be called after creating a Tree Element STDMETHOD_(I3DShScene*, GetScene) (THIS) PURE; //-- Naming STDMETHOD(SetName) (THIS_ char* name) PURE; STDMETHOD(GetName) (THIS_ char* name) PURE; //-- Tree navigation STDMETHOD_(I3DShTreeElement*, GetFirst) (THIS) PURE; // Gives first son STDMETHOD_(I3DShTreeElement*, GetLast) (THIS) PURE; // Gives last son STDMETHOD_(I3DShTreeElement*, GetLeft) (THIS) PURE; // Gives left brother STDMETHOD_(I3DShTreeElement*, GetRight) (THIS) PURE; // Gives right brother STDMETHOD_(I3DShTreeElement*, GetTop) (THIS) PURE; // Gives father //-- Tree manipulation STDMETHOD_(I3DShTreeElement*, Unlink) (THIS) PURE; // Unhook tree element from father, and returns old father STDMETHOD(InsertFirst) (THIS_ I3DShTreeElement* newSon) PURE; // Insert as the first son STDMETHOD(InsertLast) (THIS_ I3DShTreeElement* newSon) PURE; // Insert as the last son STDMETHOD(InsertLeft) (THIS_ I3DShTreeElement* newBrother) PURE; // Insert as the first left brother STDMETHOD(InsertRight) (THIS_ I3DShTreeElement* newBrother) PURE; // Insert as the first right brother //-- Tree transformations STDMETHOD(GetTransform) (THIS_ TREETRANSFORM3D* treeTransform) PURE; // Local transform STDMETHOD(SetTransform) (THIS_ TREETRANSFORM3D* treeTransform) PURE; // Local transform STDMETHOD(GetGlobalTransform) (THIS_ TREETRANSFORM3D* treeTransform) PURE; // Global transform STDMETHOD(SetGlobalTransform) (THIS_ TREETRANSFORM3D* treeTransform) PURE; // Global transform //-- Hot point STDMETHOD(GetHotPoint) (THIS_ VECTOR3D* hotPoint) PURE; // In local coordinates STDMETHOD(SetHotPoint) (THIS_ VECTOR3D* hotPoint) PURE; // In local coordinates STDMETHOD(CenterElementOnHotPoint) (THIS) PURE; // This moves the tree element STDMETHOD(CenterHotPointOnElement) (THIS) PURE; // This moves the hot point STDMETHOD(TranslateHotPoint) (THIS_ VECTOR3D* delta) PURE; // Translates hotpoint of delta (In local coordinates) //-- Misc. STDMETHOD_(I3DShTreeElement*, Clone) (THIS_ BOOLEAN cloneAll) PURE; STDMETHOD(GetBBox) (THIS_ BOX3D* bbox, BOOLEAN excludeLightsAndCameras) PURE; STDMETHOD(BeginMove) (THIS) PURE; STDMETHOD(EndMove) (THIS) PURE; //-- XYZ Scaling STDMETHOD(GetXYZScaling) (THIS_ VECTOR3D* xyzScaling) PURE; STDMETHOD(SetXYZScaling) (THIS_ VECTOR3D* xyzScaling) PURE; //-- IK STDMETHOD_(short,GetNbrFreedom)(THIS) PURE; STDMETHOD(GetFreedomRange)(THIS_ short index,NUM3D *min,NUM3D *max) PURE; STDMETHOD(GetFreedomTransform)(THIS_ MATRIX3D *RR,VECTOR3D *TT) PURE; STDMETHOD(GetFreedomDerivative)(THIS_ short index,MATRIX3D *RR,VECTOR3D *TT) PURE; STDMETHOD(IncrementFreedomValue)(THIS_ short index,NUM3D *value) PURE; //-- STDMETHOD(GetFullName) (THIS_ char* fullName) PURE; // Returns the "path name" of the tree element (nodes separated by kPathNameSeparator) //-- Tree transformations API8 (more useful) STDMETHOD(GetTransform8) (THIS_ TREETRANSFORM3D* treeTransform) PURE; STDMETHOD(SetTransform8) (THIS_ TREETRANSFORM3D* treeTransform) PURE; STDMETHOD(GetGlobalTransform8) (THIS_ TREETRANSFORM3D* treeTransform) PURE; STDMETHOD(SetGlobalTransform8) (THIS_ TREETRANSFORM3D* treeTransform, short mode=kXTreeBehaviorDefault) PURE; //-- TreeBehavior API10 STDMETHOD_(ULONG, GetTreeBehaviorsCount) (THIS) PURE; STDMETHOD_(I3DShTreeBehavior*, GetTreeBehaviorByIndex) (THIS_ ULONG index) PURE; // index is 1 based STDMETHOD_(ULONG, GetDeformerCount) (THIS) PURE; STDMETHOD_(I3DShDeformer*, GetDeformerByIndex) (THIS_ ULONG index) PURE; // index is 1 based STDMETHOD_(ULONG, GetDataComponentsCount) (THIS) PURE; STDMETHOD_(I3DExGenericData*, GetDataComponentByIndex) (THIS_ ULONG index) PURE; // index is 1 based STDMETHOD(BehaviorsChanged) (THIS) PURE; STDMETHOD(DeformersChanged) (THIS) PURE; STDMETHOD(LinksChanged) (THIS) PURE; STDMETHOD(GenericDataChanged) (THIS) PURE; //-- BehaviorMessageFlags STDMETHOD_(long, GetBehaviorMessageFlags) (THIS) PURE; }; /*****************************************************************************\ * I3DShGroup * * * * I3DShGroup is a tree element that can be collapsed ("closed") or not. * * It can return a I3DShTreeElement interface on demand. * * * \*****************************************************************************/ struct InstanceAndTransform { I3DShInstance *fInstance; AFFINETRANSFORM fT; }; #undef INTERFACE #define INTERFACE I3DShGroup DECLARE_INTERFACE_(I3DShGroup, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShGroup methods STDMETHOD(SetBBox) (THIS_ BOX3D* bbox) PURE; STDMETHOD(DoOpenClose) (THIS_ BOOLEAN openIt) PURE; // Use this call to open or close a group STDMETHOD(OpenClose) (THIS_ BOOLEAN openIt) PURE; // This lower level call just changes the status STDMETHOD_(BOOLEAN, IsOpen) (THIS) PURE; //4.5 STDMETHOD(BeginGetInstances) (THIS_ long &nbrInstances,const InstanceAndTransform *&instances) PURE; STDMETHOD(EndGetInstances) (THIS) PURE; STDMETHOD(RayHit) (THIS_ BOOLEAN &didHit,const Ray3D &aR,const RayHitParameters ¶ms,RayHit3D &hit) PURE; }; /*****************************************************************************\ * I3DShLightsource * * * * I3DShLightsource defines the light sources as tree elements * * It can return a I3DShTreeElement interface on demand. * * * \*****************************************************************************/ struct TLightTraceElement; #undef INTERFACE #define INTERFACE I3DShLightsource DECLARE_INTERFACE_(I3DShLightsource, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShLightsource methods STDMETHOD(GetLightGlobalTransform) (THIS_ TRANSFORM3D* transform) PURE; // A little bit like GetGlobalTransform(), but without the scaling factor STDMETHOD_(BOOLEAN, GetDirection) (THIS_ VECTOR3D* position, VECTOR3D* resultDirection, NUM3D* resultDistance) PURE; STDMETHOD_(BOOLEAN, GetColor) (THIS_ VECTOR3D* position, VECTOR3D* direction, NUM3D distance, COLOR3D* result, BOOLEAN* callForShadowEffect) PURE; STDMETHOD(ShadowEffect) (THIS_ NUM3D distanceThru, NUM3D distanceTotal, COLOR3D* result) PURE; STDMETHOD(ForEachShadowBuffer) (THIS_ ForEachShadowBufferCallback proc, void* priv) PURE; STDMETHOD(GetLightParameter) (THIS_ long keyword, void* parameter) PURE; //4.5 STDMETHOD(GetPrimitiveID) (THIS_ long &primID) PURE; STDMETHOD(GetNewTrace) (THIS_ short &nb,TLightTraceElement *&traceElem) PURE; STDMETHOD_(I3DExShadowFeature*, GetShadowFeature) () PURE; }; /*****************************************************************************\ * I3DShCamera * * * * I3DShCamera defines the cameras as tree elements * * It can return a I3DShTreeElement interface on demand. * * * \*****************************************************************************/ #undef INTERFACE #define INTERFACE I3DShCamera DECLARE_INTERFACE_(I3DShCamera, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShCamera methods STDMETHOD(GetGlobalToCameraTransform) (THIS_ TRANSFORM3D* transform) PURE; // Gives the transformation from the Global Coordinate System to the Screen Coordinate System STDMETHOD(Preset) (THIS_ ULONG preset, VECTOR3D* aimedPoint, NUM3D distance) PURE; // See preset codes above STDMETHOD_(BOOLEAN, Project3DTo2D) (THIS_ VECTOR3D* position, VECTOR2D* resultScreenPosition, NUM3D* resultDistanceToScreen) PURE; STDMETHOD_(BOOLEAN, CreateRay) (THIS_ VECTOR2D* screenPosition, VECTOR3D* resultOrigin, VECTOR3D* resultDirection) PURE; STDMETHOD_(ULONG, Clip3D) (THIS_ FACET3D* localFacet, VERTEX3D* localVertices, FACET3D* cameraFacet, VERTEX3D* cameraVertices, NUM3D* clipBox) PURE; STDMETHOD(GetRenderUVBox) (THIS_ BOX2D *uvBox) PURE; }; /*****************************************************************************\ * I3DShInstance * * * * I3DShInstance defines the object instances in the tree * * It can return a I3DShTreeElement interface on demand. * * * \*****************************************************************************/ enum {kUVMapColor=1, kUVMapHighlight=2, kUVMapShininess=4, kUVMapBump=8, kUVMapReflection=16, kUVMapTransparency=32, kUVMapRefraction=64, kUVMapGlow=128}; enum {kUVMapColorIndex,kUVMapHighlightIndex,kUVMapShininessIndex,kUVMapBumpIndex, kUVMapReflectionIndex,kUVMapTransparencyIndex,kUVMapRefractionIndex, kUVMapGlowIndex}; enum {kNbrUVMapsIndices=8}; #define UVMapIndexToMask(index) (1<<index) struct UVMaps { IShRasterOffscreen *fMap[kNbrUVMapsIndices]; }; struct MapParams { Boolean fFlipVert; // true if and only if the map ]r should be flipped FROM ITS ORIGINAL orientation Boolean fFlipHoriz; NUM3D fBrightness; // A quickfix number between zero and one (65536) short fNinetyDegreeCount; // number between 0 and 3 indicating the number of rotations to do on the map }; DECLARE_INTERFACE_(I3DFacetCache, IUnknown) { }; DECLARE_INTERFACE_(I3DShIRCache, IUnknown) { }; struct TZBInfo; struct IShLineArt; struct I3DShCamera; DECLARE_INTERFACE_(IFacetMesh, IUnknown) { STDMETHOD(GetFacetMesh) (FacetMesh &facetMesh) PURE; STDMETHOD(GetLevelOfDetail) (NUM3D &lod) PURE; }; #undef INTERFACE #define INTERFACE I3DShInstance DECLARE_INTERFACE_(I3DShInstance, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShInstance methods //-- Object referencing STDMETHOD_(I3DShObject*, Get3DObject) (THIS) PURE; STDMETHOD(Set3DObject) (THIS_ I3DShObject* object) PURE; //-- Shading at the Instance level STDMETHOD_(ULONG, GetUVSpaceCount) (THIS) PURE; STDMETHOD(GetUVSpace) (THIS_ ULONG uvSpaceID, UVSpaceInfo* uvSpaceInfo) PURE; STDMETHOD(AddShadingShape) (THIS_ ShadingShape* shadingShape, ULONG uvSpaceID) PURE; STDMETHOD(GetShadingFlags) (THIS_ ShadingFlags* theFlags) PURE; STDMETHOD(DoShade) (THIS_ ShadingInOut* shadingInOut) PURE; STDMETHOD(GetMainColors) (THIS_ COLOR3D* color1, COLOR3D* color2) PURE; STDMETHOD_(long, GetShadingLevel) (THIS) PURE; STDMETHOD(GetUVRasterShMap) (THIS_ long uvSpaceIndex,short& sizeU, short& sizeV, UVMaps* maps, long channels, void *viewPriv) PURE; STDMETHOD(GetUVExportShMap) (THIS_ long uvSpaceIndex,short& sizeU, short& sizeV, FixPtRect *range, UVMaps* maps, long channels) PURE; STDMETHOD_(BOOLEAN, FreeUVShMap) (THIS_ long uvSpaceIndex) PURE; //-- For renderers STDMETHOD(GetFlatness) (THIS_ NUM3D *flatness) PURE; STDMETHOD(Draw) (THIS_ TZBInfo *aZBInfo, short *drawn) PURE; STDMETHOD(DrawLA) (THIS_ IShLineArt *aLineArt,TREETRANSFORM3D *aTS,I3DShCamera *acamera,RECT3D *area,short modeD) PURE; STDMETHOD(GetBoxes) (THIS_ TZBInfo *aZBInfo,NUM3D *minZ,NUM3D *maxZ,BOX2D *clip,BOX3D *box) PURE; STDMETHOD(GetBB) (THIS_ BOX3D *bbox) PURE; STDMETHOD(Dehydrate) (THIS_ short level) PURE; STDMETHOD_(BOOLEAN,RayHit) (THIS_ Ray3D *aR,RayHitParameters *params,RayHit3D *hit) PURE; STDMETHOD(GetAllInfo) (THIS_ RayHit3D *hit,short *uvSpaceID) PURE; //-- New misc. calls (API level 6) STDMETHOD_(I3DShObject*, GetDeformed3DObject) (THIS) PURE; // Same as Get3DObject(), but with the deformations applied on the object STDMETHOD(EnumFacetsWithConversion) (THIS_ EnumFacetsCallback callback, void* privData, BOOLEAN doPatches, NUM3D error) PURE; // Use this call when you want facets even for patch based objects, and be able to control the error in the facettisation process STDMETHOD(SetShadingFromMaps) (THIS_ long uvSpaceIndex, UVMaps* maps, MapParams* mapParams, const FixPtRect& shapeRect) PURE; STDMETHOD_(short, GetMappingKind) (THIS) PURE; STDMETHOD(SetMappingKind) (THIS_ short mappingKind) PURE; STDMETHOD(GetMappingDirection) (THIS_ MATRIX3D* transform) PURE; STDMETHOD(SetMappingDirection) (THIS_ MATRIX3D* transform) PURE; STDMETHOD(GetURL) (THIS_ char* name, short *kind) PURE; STDMETHOD_(long, GetClassSignature) (THIS) PURE; STDMETHOD_(long, GetInstanceKind) (THIS) PURE; STDMETHOD(GetShadingBBox) (THIS_ BOX3D* shadingBBox) PURE; //API8 STDMETHOD_(BOOLEAN, IsVolumeInstance) (THIS) PURE; //4.5 STDMETHOD(GetFMesh) (NUM3D lod,IFacetMesh *&amesh) PURE; STDMETHOD(SetFCache) (void *priv,const AFFINETRANSFORM &aT,I3DFacetCache *theFCache) PURE; STDMETHOD(GetFCache) (void *priv,const AFFINETRANSFORM &aT,I3DFacetCache *&theFCache) PURE; STDMETHOD(ClearFCache) (void *priv) PURE; STDMETHOD(GetIndex) (long &index) PURE; STDMETHOD(GetVertexUV) (BOOLEAN &res,const VECTOR3D &theVertex,VECTOR2D &theUV) PURE; STDMETHOD_(BOOLEAN, IsShadowCastingOn) (THIS) PURE; STDMETHOD_(I3DExReflectionFeature*, GetReflectionFeature) () PURE; STDMETHOD_(I3DExRefractionFeature*, GetRefractionFeature) () PURE; STDMETHOD_(BOOLEAN, ChangeUVForProjectionMapping) (long nbrVertices,VERTEX3D *vertices) const PURE; //5.0 STDMETHOD(ExportFMesh) (NUM3D quality,FacetMesh &facetMesh) const PURE; //quality==1 is default (average) }; #undef INTERFACE #define INTERFACE I3DShExtension DECLARE_INTERFACE_(I3DShExtension, IUnknown) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DShExtension methods STDMETHOD_(char*, GetParamsBuffer) (THIS) PURE; STDMETHOD_(short, GetResID) (THIS) PURE; STDMETHOD_(short, GetViewID) (THIS) PURE; STDMETHOD_(BOOLEAN, IsEqual) (THIS_ I3DShExtension* extension) PURE; STDMETHOD(GetParameter) (THIS_ long param,void *) PURE; STDMETHOD(SetParameter) (THIS_ long param,void *) PURE; STDMETHOD_(long, GetClassSignature) (THIS) PURE; STDMETHOD(GetComponentClassName) (THIS_ char* name) PURE; }; #endif